<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,minimum-scale=1,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <link rel="stylesheet" type="text/css" href="/public/static/wx/css/base.css" />
    <link rel="stylesheet" type="text/css" href="/public/static/wx/font/font-awesome-4.7.0/css/font-awesome.css" />
    <script src="/public/static/wx/js/flex.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="/public/static/plugins/layui/css/layui.css" media="all" />
    <title>跟踪状态</title>
    <style type="text/css">

    </style>
</head>

<body>
<div class="index">

    <div class="layui-card">
        <div class="layui-card-header">任务完成情况</div>
        <div class="layui-card-body">
            <div class="layui-collapse" id="tab_list">

                <!--<div class="layui-colla-item">
                    <h2 class="layui-colla-title">杜甫</h2>
                    <div class="layui-colla-content layui-show">
                    </div>
                </div>-->

            </div>
        </div>
    </div>

</div>

<script src="/public/static/plugins/layui/layui.all.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

    var id = '{:input("id")}';
    var mid = '{:session("muid")}';
    var $ = null;
    layui.use(['element','jquery'], function() {
        var element = layui.element;
        $=layui.jquery;

        $.post('{:url("track")}',{dis_id:id},function (data) {
            $.each(data.data,function (k,v) {
                let str = '<div class="layui-colla-item">\n' +
                    '    <h2 class="layui-colla-title">'+v.title+'('+v.admin_name+(v.is_comp==1?'-<span style="color: green">已完成</span>':'-<span style="color: red">正在进行</span>')+')-'+v.add_time+'</h2>\n' +
                    '    <div class="layui-colla-content '+(k==0?'layui-show':'')+'" style="padding: 3px 10px;">\n';

                str += '<table class="layui-table"><tbody>';
                $.each(v.list,function (kl,vl) {
                    str += '<tr><td class="text-center"><img src="'+vl.icon+'" alt="" style="max-width: 22px;"></td><td>'+'【'+vl.admin_name+'】'+vl.content+expl(vl.attach)+'<br><span style="font-size: 14px;color: #999">'+vl.c_time+'</span>'+(vl.admin_id==mid?'<span cid="'+vl.id+'" step="'+vl.step+'" class="relo" onclick="reload(this)" style="color: #2D7F04;">'+(vl.step==6||vl.step==9?'重新上传':'')+'</span>':'')+'</td></tr>';
                });
                str += '</tbody></table>';

                str += '    </div>\n' +
                    '</div>';
                $('#tab_list').append(str);
            });
            element.render();
        });
    });

    //重新上传
    function reload(_t) {
        var step = $(_t).attr('step');
        var id = $(_t).attr('cid');
        if(step==6||step==9){
            location.href = '{:url("trackre/index")}?id='+id;
        }
    }

    //图片
    function imgeng(_t) {
        location.href = $(_t).attr('src');
    }

    function expl(att) {
        let arr = att.split(';');
        let str = '<div>';
        for (al in arr) {
            if(arr[al].length>0){
                str += '<span><img src="'+arr[al]+'" alt="" onclick="imgeng(this)"></span>';
            }
        }
        str += '</div>';
        return str;
    }

</script>
</body>

</html>